package org.infodavid.common.services.exceptions;

/**
 * The Interface IErrorHandler.
 * @param <E> the exception
 */
public interface IErrorHandler<E extends ServiceException> {

  /**
   * Handle .
   * @param error the error
   * @param source the source
   * @param retry the retry count
   * @param message the message
   * @return true to allow retry
   * @throws <E> the exception
   */
  boolean handle(final Throwable error, final String message, final Object source, final int retry)
      throws E;

  /**
   * Handle .
   * @param error the error
   * @param source the source
   * @param message the message
   * @return true to allow retry
   * @throws <E> the exception
   */
  boolean handle(final Throwable error, final String message, final Object source) throws E;
}
